package com.shux.usermanager.action;

import java.io.ByteArrayOutputStream;
import java.io.IOException;

import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.shux.common.biz.ISecurityBiz;

/**
 **********************************************
 *  描述：后台管理系统登录验证码
 * Simba.Hua
 * 2017年5月29日
 **********************************************
**/
@Controller
@RequestMapping("/usermanager")
public class SecturityAction {
    private @Autowired ISecurityBiz securityBiz;
    private Logger logger = LoggerFactory.getLogger(getClass());
    
    @RequestMapping("/loginSecurityCode")
    public void loginSecurityCode(HttpServletResponse response){
        try {
            ServletOutputStream sos = response.getOutputStream();
            ByteArrayOutputStream byteoutput = securityBiz.generateCode();
            byteoutput.writeTo(sos);
        } catch (IOException e) {
            logger.error("security code output error!",e);
        }
    }
}
